Results 1 to 8 of 8

Thread: Adjusting the number of nades per map?

  1. #1

    Default Adjusting the number of nades per map?

    Hi guys,

    is it possible to reduce the number of handgrenades for a specific map, say only 1 nade for Stalingrad but all
    other maps have the "normal" amount as specified in the nades .tik files?

    I tried my (limited) scripting knowledge to see if I could script something using DMSTARTAMMO, but the TIK files keep overruling my attempts.
    Also tried our best friend Google but came up short there too..
    Am using the Reborn spawnhandler for all weapons, so maybe something using a switch will do.

    Can someone with more scripting experience please lend me a hand?


    Cheers!

  2. #2

    Default

    maybe something like this would work it's from a sniper only mod
    Code:
    main:
    
      if(getcvar(mapname)=="dm/mohdm6")  
      {
    thread nades
    {
    
    end
    
    nades:
    
    	if(level.v_sniperspawned == 1)
    		end
    	level.v_sniperspawned = 1
    	
    	local.result = registerev "spawn" global/sniper_spawned.scr::spawn
    	local.result = registerev "connected" global/sniper_spawned.scr::connected
    end
    
    spawn local.player:
    	if(local.player.isSpawning == 1)
    		end
    	local.player.isSpawning = 1
    	wait 0.4
    	if(local.player.dmteam == "axis") {
    		local.player takeall
    		wait 0.2
    		 local.player give "models/weapons/steilhandgranate.tik"
    		wait 0.4	
    	} else if(local.player.dmteam == "allies") {
    		local.player takeall
    		wait 0.2
    		 local.player give "models/weapons/m2frag_grenade.tik"
    		wait 0.4
    	}
    	// Assuming we're running pure CKR here, 3 nades per person
    	local.player ammo grenade -2
    	
    	local.player.isSpawning = 0
    end
    
    connected local.player:
    	if(local.player.dmteam != "spectator")
    		thread spawn local.player
    end
    or maybe this will help

    Code:
      if(getcvar(mapname)=="dm/mohdm6")  
      {
    thread nades
    {
    
    end
    
    nades:
    
    local.nade = getcvar "grenade"
    
    if(local.nade == "" || local.nade == NIL || local.nade == NULL)
    	{self ammo grenade 0}
    else
    	{
    	
    		local.nade = (getcvar "grenade")
    		self ammo grenade local.nade
    	}
    
    end
    Last edited by easymeat; October 12th, 2015 at 10:14 AM.

  3. #3
    Purple Developer Purple Elephant1au's Avatar
    Join Date
    Feb 2012
    Location
    Australia
    Posts
    1,259

    Default

    Its kinda simple really

    Have a look at my weapon mod, or creapers weapon mod, both have a
    execute <script>
    within each weapon, or in this case the nade.txt files

    What you need to do it execute a script FROM each grenade,txt (actual weapon ones) AFTER where the dmstartammo is set. Then use simple if statement to change between nade amounts

    Example
    m2frag_grenade_base.txt
    Code:
    // DM Attributes
            dmprojectile        models/projectiles/M2FGrenade_primary.tik
            dmstartammo            1
            dmammorequired        1
            dmfiredelay            0.75
            dmcrosshair            0
            dmmovementspeed        0.88
            dmmovementspeed        0.8
            secondary dmprojectile    models/projectiles/M2FGrenade.tik
            secondary dmammorequired    1
            secondary dmfiredelay        0.75
    
            //custom wep settings
            exec global/weapon_settings.scr     <<< custom script, call what you like
    Then create a script that changes the dmstartammo, with 'self' being the weapon entity
    global/weapon_settings.scr
    main:
    
    local.map = getcvar(map);
    
    if(local.map == "dm/mohdm6")
    {
    self dmstartammo "1";
    }
    else
    {
    self dmstartammo "2"; /// or whatever you want as 'normal' or you could just remove this else statement and not change anything from default.
    }
    
    end;

    Or ofc you can use my weapon limiter mod, and just set cvars lol

    Purple's Playground
    OBJ :
    103.29.85.127:12203
    xfire: purpleelephant1au
    email: purpleelephant1au@gmail.com
    skydrive: PurpleElephantSkydrive




  4. #4

    Default

    Hmm, did everything exactly like you explained but can't get it to work, Purple.
    There isn't an error in consolelog either.

    If anything the ELSE statement -does- work. The default nade tik files are set to 6 nades but are set to give 3 in the ELSE statement.
    So it gives me only three nades.
    But it also gives me 3 nades on Stalingrad where it should only give one.
    Weird..
    Something to do with parsing the map cvar perhaps?

  5. #5

    Default

    The cvar to get the map name is wrong is getcvar(mapname) not map

  6. #6

    Default

    Works perfectly now!

    Thanks guys for all your help

  7. #7

    Default

    Hello, I need help friends, I need a pk3 that limits to two or a grenade, can anyone help me?

  8. #8

    Default

    you need to open the ckr mod and go to models/weapons and open m2frag_grenade_base.txt and steilhandgranate_base.txt, than find dmstartammo 3 // CKR Modified from 6
    change the 3 into what u want.. here is the file wher eu have to do itzzzzzzzzzzzzzzzzzUser_-_z_CKR_11.pk3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •